{layout name="layout/layout" /}
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">会员等级列表</li>
    </ul>
</div>
<a class="layui-btn" href="{:Url('Admin/Viplevel/add')}">添 加</a>
<div class="layui-form">
    <table class="layui-table">
        <colgroup>
            <col width="7%">
            <col width="10%">
            <col width="10%">
            <col width="20%">
            <col width="10%">
            <col width="43%">
        </colgroup>
        <thead>
            <tr style="background-color: #f5f5f5;font-size: 17px">
                <td>会员等级</td>
                <td>等级名</td>
                <td>积分范围</td>
                <td>等级权益</td>
                <td>添加时间</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            {if($data)} {foreach $data as $k=>$v}
            <tr>

                <td>
                    {$v->level}
                </td>
                <td>
                    {$v->title} &nbsp;
                </td>
                <td>
                    {$v->range_up}-{$v->range_down} &nbsp;
                </td>
                <td style="text-align: left">
                    {foreach $v->privileges as $k1=>$v1}
                    <span style="text-align: left;color: red;font-size: 16px">{$k1+1}:{$v1->title}
                        <br>
                    </span>
                    {/foreach}
                </td>

                <td>
                    {$v->time|date="Y-m-d",###}

                </td>
                <td>
                    <div class="layui-btn-group">
                        <a class="layui-btn layui-btn-xs" href="{:Url('admin/viplevel/edit',['id'=>$v->id])}">编辑</a>
                        <a class="dell layui-btn layui-btn-danger layui-btn-xs" help_id="{$v->id}" href="#">删除</a>
                    </div>

                </td>
            </tr>
            {/foreach} {/if}
        </tbody>
    </table>
</div>
<script>
    $('.dell').click(function () {
        var id = $(this).attr('help_id');
        layer.confirm('是否确认删除？', {
            btn: ['确认', '取消'] //按钮
        }, function () {
            $.post("{:Url('admin/viplevel/del')}", { help_id: id }, function (data) {
                window.location.reload();
                if (!data) {
                    layer.msg('删除失败');
                }
            });
        })
    });
</script>